package com.thrc.borrow.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.thrc.borrow.entity.SystemSetting;
import com.thrc.borrow.service.SystemSettingService;
import com.thrc.borrow.utils.ResponseUtil;
import com.thrc.borrow.utils.ReturnCode;

@Controller
@RequestMapping("/systemSetting")
public class SystemSettingController {

	@Autowired
	private SystemSettingService systemSettingService;

	@RequestMapping("/goSysSetingJsp")
	public String goMenuJsp() {

		return "sys/sysSeting";
	}

	@RequestMapping("/get")
	public void getSystemSetting(HttpServletResponse response) {
		SystemSetting t = new SystemSetting();
		ResponseUtil.print(response, systemSettingService.selectById(t));
	}

	@RequestMapping("/update")
	public void update(HttpServletResponse response, SystemSetting t) {
		try {
			systemSettingService.update(t);
			ResponseUtil.print(response, ReturnCode.SUCCESS_CODE);
		} catch (Exception e) {
			e.printStackTrace();
			ResponseUtil.print(response, ReturnCode.FAIL_CODE, e.getMessage());
		}
	}
}
